pull: Delete processed delta parts
authorColin Walters <walters@verbum.org>
Thu, 15 Jan 2015 03:18:00 +0000 (22:18 -0500)
committerColin Walters <walters@verbum.org>
Thu, 15 Jan 2015 03:18:00 +0000 (22:18 -0500)
Otherwise they stay around until a much later GC.

src/libostree/ostree-repo-pull.c

index 0c4e22b8b6991b8b7d14d0c2a37ba4c6f349c65e..b5b780eba3a7c3327d87b0b7bd0890d4bc750c6c 100644 (file)
@@ -857,6 +857,12 @@ static_deltapart_fetch_on_complete (GObject           *object,
     delta_data = g_mapped_file_get_bytes (mfile);
     g_mapped_file_unref (mfile);
 
+    /* Unlink now while we're holding an open fd, so that on success
+     * or error, the file will be gone.  This is particularly
+     * important if say we hit e.g. ENOSPC.
+     */
+    (void) unlinkat (pull_data->tmpdir_dfd, temp_path, 0); 
+
     _ostree_static_delta_part_execute_async (pull_data->repo,
                                              fetch_data->objects,
                                              delta_data,